﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Windows.Data;
using System.Globalization;

namespace BadHabit.WPFTools.Converters {

    [ValueConversion(typeof(double), typeof(double))]
    public class DoubleMultiplyConverter : IValueConverter {

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
            if (!(value is double))
                return 0;
            double d2 = 0;
            double.TryParse(parameter.ToString(), out d2);

            double d1 = (double)value;
            
            return d1 * d2;


        }


        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
            return new NotSupportedException();
        }


    }
}
